// import Vue from 'vue'
// import Vuex from 'vuex'
import createPersistedState   from 'vuex-persistedstate' //解决Vuex持久化插件-在F5刷新页面后数据不见的问题

Vue.use(Vuex)

const store = new Vuex.Store({
	state:{ 
		//面包屑
		breadcrumbItems : [], 
		//登陆框显示
		loginFormShow   :false,
		//
		token           :'',
		//当前打开的是 移动端 还是 pc 端
		isMobile        : false,
		username        : '',
		language        : 'zh_cn',
	},
	getters:{ 
		breadcrumbItems : state => state.breadcrumbItems,  
		loginFormShow   : state => state.loginFormShow  ,  
		token           : state => state.token ,  
		isMobile        : state => state.isMobile ,  
		username        : state => state.username ,  
		language        : state => state.language ,  
	},
	mutations : { 
		setbreadcrumbItems(state,data){
			state.breadcrumbItems = data
		},   
		setloginFormShow(state,data){
			state.loginFormShow = data
		}, 
		settoken(state,data){
			state.token = data
		},
		setisMobile(state,data){
			state.isMobile = data
		},
		setusername(state,data){
			state.username = data
		},
		setlanguage(state,data){
			state.language = data
		},
	},
	actions:{

	},
	plugins: [createPersistedState({
		//默认存储到localStorage
		//想要存储到sessionStorage，配置如下
		storage: window.sessionStorage
	})]
})

export default store